<template>
	<view>
		<view class="bj1">
			<span class="sj">发起讨论</span>
			<view class="fl">
				<u-button @click="adddiscuss()" type="primary" style="width: 55px;height: 35px;" shape="circle" color="#fff">
					<span style="color: #2BCDDD;font-size: 12px;">发布</span>
				</u-button>
			</view>
		</view>
		<view class="zong">
			<view style="width: 4px;height: 17px;background-color: #FF5E81;margin-left: 20px;margin-top: 10px;border-radius: 15px;display: inline-block"></view>
			<span style="margin-left: 12px;font-size: 14px;color: #333333;"><b>讨论标题</b></span>
			<uni-easyinput type="text" style="width: 300px;margin-left: 20px;" v-model="title" placeholder="讨论标题" />
			<view style="width: 4px;height: 17px;background-color: #FF5E81;margin-left: 20px;margin-top: 20px;border-radius: 15px;display: inline-block"></view>
			<span style="margin-left: 12px;font-size: 14px;color: #333333;"><b>讨论分类</b></span>
			<uni-data-checkbox style="margin-left: 20px;" v-model="pltype" :localdata="range" @change="change"></uni-data-checkbox>
			<view style="width: 4px;height: 17px;background-color: #FF5E81;margin-left: 20px;margin-top: 20px;border-radius: 15px;display: inline-block"></view>
			<span style="margin-left: 12px;font-size: 14px;color: #333333;"><b>讨论详情</b></span>
			<uni-easyinput type="textarea" v-model="contents" style="margin-left: 20px;width: 350px;" placeholder="请输入自我介绍" />
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				range: [{"value": 1,"text": "闲置"	},{"value": 2,"text": "求助"},{"value": 3,"text": "吐槽"},{"value": 4,"text": "社区"}],
				title:'',
				pltype:1,
				contents:'',
				userid:'',
			}
		},
		onLoad() {
			uni.getStorage({
				key:'userid',
				success: res=>{
					this.userid=res.data
				}
			})
		},
		methods: {
			adddiscuss(){
				
				uni.request({
					url:'http://localhost:9525/xkuser/ljp/adddiscuss',
					method: 'GET',
				   data: {
					   title: this.title,
					   pltype: this.pltype,
					   contents: this.contents,
					   userid: this.userid,
				   },
				   dataType:'json',
				   success: (res) => {
						uni.navigateTo({
							url:'./tlquan'
						})
					},
				})	
			}
		}
	}
</script>

<style>
	.zong{
		width: 100%;
		height: 600px;
		background-color: #FFFFFF;
		margin-top: -150px;
	}
	.fl{
		width: 25px;
		height: 25px;
		/* background-image: url(../../static/img/fenlei.png); */
		/* background-color: #000000; */
		margin-left: 300px;
		position: absolute;
		top: 20px;
		
	}
	.sj{
		font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';
		    font-weight: 700;
		    font-size: 20px;
		    color: #FFFFFF;
		    margin-left: 15px;
			position: absolute;
			top: 20px;
	}
	.bj1{
			width:100%;
			height:468rpx;
			background-image: url(../../static/indeimg/xia.png);
			
		}
</style>
